use rstest::rstest;

use crate::tests::fixtures::{rand_usize, RANDOM_USIZE};
use crate::tiling;
use crate::tiling::Direction;

#[rstest]
#[case::north_west_corner((1, 1), Direction::South, *RANDOM_USIZE + 11)]
#[case::south_east_corner((3, 2), Direction::West, *RANDOM_USIZE + 4)]
#[case::border_tile_north(
    (0, rand_usize(1, 3)), Direction::South, *RANDOM_USIZE + 9
)]
#[case::border_tile_west(
    (rand_usize(1, 4), 3), Direction::East, *RANDOM_USIZE + 2
)]
#[case::border_tile_south(
    (4, rand_usize(1, 3)), Direction::North, *RANDOM_USIZE + 6
)]
#[case::border_tile_east(
    (rand_usize(1, 4), 0), Direction::West, *RANDOM_USIZE + 10
)]
#[case::no_slot((1, 2), Direction::South, 0)]
#[case::no_tile_id((2, 2), Direction::West, 0)]
fn test_slot_grid_get_tile_connector(
    #[case] coordinates: (usize, usize),
    #[case] side: Direction,
    #[case] expected_connector: usize,
) {
    let slot_grid = tiling::slot_grid::tests::create_test_slot_grid(false, false);

    let connector_id = slot_grid.get_tile_connector(coordinates, side);
    assert_eq!(connector_id, expected_connector);
}
